import {ref,reactive} from 'vue'
import {defineStore} from 'pinia'
import { communityInfoListGet, communityInfoPageGet} from '@/api/communityInfoApi.js';

export const useCommunityInfoStore = defineStore('communityInfo', () => {

const communityInfoPage = ref([])
const communityInfoList = ref([])
const pagination = reactive({
    current:1,
    total:0
})

async function getCommunityInfoPage(query = {}) {
let {records, current, total} =await communityInfoPageGet(query)
communityInfoPage.value = records
pagination.current = current
pagination.total = total
}

async function getCommunityInfoList(query = {}) {
communityInfoList.value = await communityInfoListGet(query)
}


return {
pagination,
communityInfoPage, getCommunityInfoPage,getCommunityInfoList}
})
